/**
 * 
 */
package cn.agiledata.bank.account.dao;

import java.io.InputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;

import cn.agiledata.bank.common.exception.BusinessException;
import cn.agiledata.bank.hibernateBean.Account;
import cn.agiledata.bank.hibernateBean.CityInfo;
import cn.agiledata.bank.hibernateBean.MoneyRole;
import cn.agiledata.bank.hibernateBean.OperSubacct;
import cn.agiledata.bank.hibernateBean.OperSubacctId;
import cn.agiledata.bank.hibernateBean.Operator;
import cn.agiledata.bank.hibernateBean.QdTransDetail;
import cn.agiledata.bank.hibernateBean.SubAccount;
import cn.agiledata.bank.hibernateBean.Sysbook;
import cn.agiledata.bank.hibernateBean.SystemLog;

/**
 * 账户信息的DAO
 * 
 * @author 马贤波
 * 
 * Mar 31, 2006
 */
public interface IAccountDAO {

	abstract public Account findAccountBySign(String sign)
			throws DataAccessException;

	abstract public Account findAccountByAccountId(String sign)
			throws DataAccessException;

	abstract public void updateAccount(Account account)
			throws DataAccessException;

	abstract public Operator findOperatorByAccount(Account account,
			String operatorId) throws DataAccessException;

	abstract public List getSubAccountDigisters(Account account)
			throws DataAccessException;

	public void updateOtherAccountDetailFlag(Long accountId, Long id);

	abstract public List getSubAccountOfAccount(Account account)
			throws DataAccessException;

	abstract public List getSubAccountOfAccountV(Account account)
			throws DataAccessException;
	
	abstract public List findDetailByOrderId(String orderId);

	abstract public void setDefaultSubAccount(Account account, Long subAccountId)
			throws DataAccessException;

	abstract public int findCountOfSubAccount(long accountId,
			String subAccountId, Long excluded) throws DataAccessException;

	abstract public void addOrUpdateSubAccount(SubAccount subAccount)
			throws DataAccessException;

	abstract public void deleteSubAccount(long defaultSubAccountId,
			long subAccountId) throws DataAccessException;

	abstract public List getOperatorsOfAccount(Account account)
			throws DataAccessException;

	abstract public int findCountOfOperator(long accountId, String operatorId,
			Long excluded) throws DataAccessException;

	abstract public Operator getOperatorById(Long operatorId)
			throws DataAccessException;

	abstract public void addOrUpdateOperator(Operator operator)
			throws DataAccessException;

	abstract public void deleteOperator(Long operatorId)
			throws DataAccessException;

	abstract public int findCountByEmail(String email)
			throws DataAccessException;

	abstract public void createAccount(Account account)
			throws DataAccessException;
	
	abstract public void createAccount(final Account acc,
			final InputStream cardPhotoStream,
			final InputStream cardPhotoBackStream,final InputStream photoStream)
	throws DataAccessException;

	abstract public void deleteAccount(Account account)
			throws DataAccessException;

	abstract public void dropAccount(Account account)
			throws DataAccessException;

	abstract public List findBanksOfSubaccountId(Long id)
			throws DataAccessException;
	abstract public List findTransHisByPara(long email, String startTime,
			String endTime) throws DataAccessException;;

	abstract public void updateLog(SystemLog log) throws DataAccessException;

	abstract public SubAccount getSubAccountById(Long id);

	abstract public Sysbook getSysBookByTypeIdAndTypeName(String typeId,
			String typeName);

	abstract public Operator deleteOperAccount(Long operid);

	abstract public OperSubacct getOperSubacctById(OperSubacctId id);

	abstract public Date getLastvisit(Long id);

	abstract public SubAccount findBalance(long AccountId, String subAccountId);

	public Account getAccountById(Long id);

	public SystemLog getLastLoginSystemLog(String id);

	public SystemLog getLastErrorLoginSystemLog(String id);

	// public AccountGrade getAccountGrade(Long id);
	/**
	 * 根据id得到Grading对象
	 * 
	 * @param id
	 * @return
	 */
	// abstract public Grading getGrading(Long id);
	abstract public List findDefaultGroup();

	public CityInfo getCityInfoById(String id);

	public CityInfo getCityInfoBySeq(Long seq);

	/** 访问sysbook表，获取登录密码输错次数上限 */
	abstract public int getMaxLoginPwdErrFromSysBook();

	/** 访问sysbook表，获取支付密码输错次数上限 */
	abstract public int getMaxPayPwdErrFromSysBook();

	/** 锁定单个账户(不能登录) */
	abstract public void lockAccountLoginBySign(String sign)
			throws DataAccessException;

	/** 获取账户当天登录密码输错次数 */
	abstract public int getCurrentLoginPwdErrByAccountId(Long id)
			throws DataAccessException;

	/** 获取账户当天支付密码输错次数 */
	abstract public int getCurrentPayPwdErrByAccountId(Long id)
			throws DataAccessException;

	public List getAccountBanksByAccountId(long accountId);

	public Account findAccountBySignAvaible(String sign)
			throws DataAccessException;
	public void saveOrUpdateTransDetail(QdTransDetail detail);
	
	/** 判断黑名单用户*/
	public boolean checkBlackList(String email)
			throws BusinessException;
	public Object queryQdTrans(String hql,Object[] params)throws Exception;
	public List<MoneyRole> getRule(String hql ,String[] param)throws Exception;
	public void update(Account account)throws Exception;
}